package com.pioneer.web.stock.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.pioneer.web.sale.domain.SalOrder;
import com.pioneer.web.stock.domain.StoInout;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * IStoInoutService
 *
 * @author hlm
 * @date 2025-04-09 14:55:26
 */
public interface IStoInoutService extends IService<StoInout> {

    /* ---------------------------------------- 入库管理 BEGIN ---------------------------------------- */

    /**
     * 根据采购订单ID返回采购入库单信息
     * @param orderId 采购订单ID
     * @return 结果
     */
    StoInout getInoutByOrder(Long orderId);

    /**
     * 根据采购入库单ID查询详情
     * @param inoutId 采购入库单ID
     * @return 结果
     */
    StoInout selectInById(Long inoutId);

    /**
     * 新增采购入库单
     * @param inout 采购入库单
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    int addIn(StoInout inout);

    /**
     * 修改采购入库单
     * @param inout 采购入库单
     * @return 结果
     */
    boolean updateIn(StoInout inout);

    /**
     * 删除采购入库单
     * @param list 采购入库单ID集合
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    boolean deleteIn(List<Long> list);

    /**
     * 确认入库
     * @param inout 采购入库单
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    boolean inoutIn(StoInout inout);
    /* ---------------------------------------- 入库管理 END ---------------------------------------- */


    /* ---------------------------------------- 出库管理 BEGIN ---------------------------------------- */

    /**
     * 根据销售订单生成销售出库单
     * @param order 销售订单
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    boolean genInoutByOrder(SalOrder order);

    /**
     * 根据销售订单删除销售出库单
     * @param order 销售订单
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    boolean delInoutByOrder(SalOrder order);

    /**
     * 根据销售出库单ID查询详情
     * @param inoutId 销售出库单ID
     * @return 结果
     */
    StoInout selectOutById(Long inoutId);

    /**
     * 修改销售出库单
     * @param inout 销售出库单
     * @return 结果
     */
    boolean updateOut(StoInout inout);

    /**
     * 确认出库
     * @param inout 销售出库单
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    boolean inoutOut(StoInout inout);
    /* ---------------------------------------- 出库管理 END ---------------------------------------- */
}
